package rest;

import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;

@Path("/Hello")
public class RestService {

	/*// This method is called if TEXT_PLAIN is request
	  @GET
	  @Produces(MediaType.TEXT_PLAIN)
	  public String sayPlainTextHello() {
	    return "Hello Jersey";
	  }

	  // This method is called if XML is request
	  @GET
	  @Produces(MediaType.TEXT_XML)
	  public String sayXMLHello() {
	    return "<?xml version=\"1.0\"?>" + "<hello> Hello Jersey" + "</hello>";
	  }

	  // This method is called if HTML is request
	  @GET
	  @Produces(MediaType.TEXT_HTML)
	  public String sayHtmlHello() {
	    return "<html> " + "<title>" + "Hello Jersey" + "</title>"
	        + "<body><h1>" + "Hello Jersey" + "</body></h1>" + "</html> ";
	  }*/
	  
	 @GET
	  @Path("/Details/{name}/{number}")
	  @Produces(javax.ws.rs.core.MediaType.TEXT_PLAIN)
	  	public String collectDetails(@PathParam("name") String name,@PathParam("number") long number ){
	  		
	//	 System.out.println(" hiiiiiiiiii");
	  		String firstName = name;
	  		long phoneNumber = number;
	  		System.out.println("\n firstName recevd in collectDetails() >>> "+firstName);
	  		System.out.println("\n phoneNumber recevd in collectDetails() >>> "+phoneNumber);
	  		
	  		return "Hello "+firstName +" \n Your PhoneNumber is :" +phoneNumber;
	  	}

	 @GET
	  @Path("/add/{number1}/{number2}")
	  @Produces(javax.ws.rs.core.MediaType.TEXT_PLAIN)
	  	public String collectDetails3(@PathParam("number1") int a ,@PathParam("number2") int b ){
	  		
	//	 System.out.println("\n hiiiiiiiiii");
	  		int sum =a+b;
	  		return "sum = "+sum;
	  	}
	 
}
